package com.seago.iceberg.config;

import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Title:
 * <p>
 * description:
 *
 * @Company: 中国船舶集团海舟系统技术有限公司-武汉
 * @author: yangs
 * @since: 2023-05-08 11:04
 * @version: 1.0
 **/
@Component
public class EntityRegistry {
	private final Map<String, Class<?>> entityMap = new ConcurrentHashMap<>();

	public void registerEntity(Class<?> entityClass) {
		entityMap.put(entityClass.getSimpleName(), entityClass);
	}

	public Class<?> getEntityClass(String entityName) {
		return entityMap.get(entityName);
	}

	public Collection<Class<?>> getAllEntities() {
		return entityMap.values();
	}
}
